﻿using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;

namespace Nirvana
{
    /// <summary>
    /// 复数形式的处理器
    /// </summary>
    public class PluralFormProcessor
    {
        public static readonly PluralFormProcessor Default = new PluralFormProcessor();
        public delegate int FormulaDelegate(long n);
        private readonly Dictionary<int,PluralFormProcessor.FormulaDelegate> PluralMap = new Dictionary<int, PluralFormProcessor.FormulaDelegate>();




        public int GetPluralFormIndex(CultureInfo cultureInfo, long number)
        {
            //LCID,获取当前区域性标识符。
            if (this.PluralMap.ContainsKey(cultureInfo.LCID))
            {
                PluralFormProcessor.FormulaDelegate formulaDelegate = this.PluralMap[cultureInfo.LCID];
                if (formulaDelegate != null)
                {
                    return formulaDelegate(number);
                }
            }
            //ISO 639-1是国际标准化组织ISO 639语言编码标准,英语（English）用en表示
            switch (cultureInfo.TwoLetterISOLanguageName)
            {
				case "az":
				case "bm":
				case "bo":
				case "dz":
				case "fa":
				case "id":
				case "ig":
				case "ii":
				case "hu":
				case "ja":
				case "jv":
				case "ka":
				case "kde":
				case "kea":
				case "km":
				case "kn":
				case "ko":
				case "lo":
				case "ms":
				case "my":
				case "sah":
				case "ses":
				case "sg":
				case "th":
				case "to":
				case "tr":
				case "vi":
				case "wo":
				case "yo":
				case "zh":
					return 0;
				case "ar": return 0;

			}
			return 0;
		}





    }
}

